define variable vdate as date.
define variable vdb like ad_name_control initial "".

for first ad_mstr no-lock where ad_addr = "~~reports".
end.
if avail ad_mstr then do:
    assign vdb =  ad_name_control .
end.

assign vdate = today - 1.
output to hwot_det.csv.
FOR EACH hwot_det NO-LOCK WHERE hwot_date = vdate  :


    put vdb ",".
 
if hwot_date  = ? then do:
    put ",".
end.
else  do:
    put string(year(hwot_date ),"9999") + "-" + string(month(hwot_date ),"99") + "-" + string(day(hwot_date ),"99") format "x(10)" ",".
end.
put   
"""" hwot_team         """," 
     hwot_ln   format "->>>>>>9"   "," 
"""" hwot_phase        """," 
"""" hwot_status       """," 
     hwot_emp_std     format "->>>>>>9.9<<"  "," 
     hwot_emp_act     format "->>>>>>9.9<<"  "," 
     hwot_person_std  format "->>>>>>9.9<<"  ","
     hwot_person_act  format "->>>>>>9.9<<"  ","
"""" hwot_nextday      """," 
     hwot_mshift     format "->>>>>>9" ","
"""" hwot_prog       format "x(12)"    """," 
"""" hwot_user1        """," 
"""" hwot_user2        """," 
"""" hwot__chr01       """," 
"""" hwot__chr02       """," 
"""" hwot__chr03       """," 
"""" hwot__chr04       """," 
"""" hwot__chr05       """," .
if hwot__dte01  = ? then do:
    put ",".
end.
else  do:
    put string(year(hwot__dte01 ),"9999") + "-" + string(month(hwot__dte01 ),"99") + "-" + string(day(hwot__dte01),"99") format "x(10)" ",".
end.
if hwot__dte02  = ? then do:
    put ",".
end.
else  do:
    put string(year(hwot__dte02 ),"9999") + "-" + string(month(hwot__dte02 ),"99") + "-" + string(day(hwot__dte02),"99") format "x(10)" ",".
end.
put
     hwot__dec01    format "->>>>>>>>9.9<<<<<<" ","
     hwot__dec02    format "->>>>>>>>9.9<<<<<<" ","
     hwot__dec03    format "->>>>>>>>9.9<<<<<<" ","
     hwot__dec04    format "->>>>>>>>9.9<<<<<<" ","
     hwot__dec05    format "->>>>>>>>9.9<<<<<<" ","
     hwot__int01    format "->>>>>>>>9" "," 
     hwot__int02    format "->>>>>>>>9" "," 
     hwot__int03    format "->>>>>>>>9" "," 
     hwot__int04    format "->>>>>>>>9" "," 
     hwot__int05    format "->>>>>>>>9" "," 
"""" hwot__log01       """," 
"""" hwot__log02       """" 
.
put skip.

END.
